<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="Pragma" content="no-cache">
        <link rel="stylesheet" href="../style/css/index.css?v=2">
        <link rel="stylesheet" href="../style/css/tc.css">
        <link rel="stylesheet" href="../style/css/all.css?v=2">
		<script src="../style/vue/vue.global.js"></script>
		<script src="../style/vue/axios.min.js"></script>
		<script src="../style/vue/md5.min.js"></script>
		<title>全部图片 | TOP图片收集管理系统</title>
	</head>
	<body>
		<div id="app">
            <div id="top">
                <div id="title">
                    <h1 id="titles">{{ title }}</h1>
                </div>
                <div id="list">
                    <div id="list_tb">
                        <img src="../style/image/gd.png" alt="下拉列表">
                    </div>
                    <div class="list">
                        <ul>
                            <li id="list_li"><a href="new.php" target="_blank">新建收集表</a></li>
                            <li id="list_li"><a :href="adminfns">管理收集表</a></li>
                            <li id="list_li"><a href="./list.html" target="_blank">历史收集列表</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div id="msg">
                <div id="imgall" v-html="files"></div>
            </div>
			
            <div id="bottom">
                Opyright © 2024 TOP图片收集管理系统 All Rights Reservedby.
            </div>
        </div>
	</body>
    <script>
        const App = {
            data() {
                return {
                    title:'全部图片',fid:'',username:'',password:'',qqnum:'',files:[],
                    adminfns:''
                }
            }, methods: {
                get_fid:function(){
                    //获取GET后面的参数
                    var url = decodeURIComponent(location.search); 
                    var cs = new Object();
                        if (url.indexOf("?") != -1) {
                        var str = url.substr(1);
                        strs = str.split("&");
                        for(var i = 0; i < strs.length; i++) {
                            cs[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                        }
                        this.fid = cs.fid;
                    }
                    return this.fid;
                },
                axio:function(id){
                    //请求服务器，收集表的信息
                    var that = this;
                    axios
                        .post("../api/upadmin.php",{fun:"all",fid:id,uname:this.username})
                        .then(function(resp) {
                            var data = resp.data;
							if(data.stat == '200'){
                                //输出图片
                                var i = 1;
                                let imgs = '<div id="imgli">';
                                console.log(data.files);
                                for(i in data.files){
                                    imgs = imgs + '<div><img loading="lazy" src="../upfile/'+that.fid+'/'+data.files[i]+'" alt="'+i+'"><li>'+data.files[i]+'</li></div>';
                                    if(i%3==0){imgs = imgs+'</div><div id="imgli">';}
                                }
                                imgs = imgs+'</div>';
                                that.files = imgs;
							}else if(data.stat == '400'){
                                if(data.msg == '无数据'){
                                    that.files = '<div style="margin:50px"> 暂无数据，还没有人提交！ </div>'
                                }else if(data.msg =="你没有权限，非创作者或管理员！"){
                                    alert('你没有权限查看其他人创建的收集表，可以尝试切换管理员账号查看！');
                                }
                                else{
                                    alert('未查询到数据！')
                                }
                            }else{
                                alert('查询数据时，发生未知错误！\n\n错误代码：'+data);
                            }
                        }).catch(function(err){
                            console.log(err);
                        });
                    
                },
                md5:function(mima){
                    if(mima==null || mima==''){var mima = new Date().getTime();}
                    var md5mima = '00000000000000000000000000011000011010100000';
                    var md5key = '00000000000000000000101111000110000101001110';
                    var md5mima=parseInt(md5mima,2);
                    var md5key=parseInt(md5key,2);
                    var ver = md5(parseInt(mima/md5mima)+md5key);
                },
				files:function(){
					
				}
                
            },mounted:function(){
                this.fid = this.get_fid();
                //this.logon();
                if(this.fid && this.fid != '' && this.fid != null && this.fid!='undefined'){
                    this.axio(this.fid);
                    this.adminfns = './new.php?fid='+this.fid;
                }else{
                    this.files = '<div style="margin:50px"> 无法获取到数据，请重试！ </div>'
                }
            },created(){     
            }
        }
    
        Vue.createApp(App).mount('#app')
    
    </script>
</html>
